﻿using System.Collections.Generic;

namespace JamesZhao.Engine
{
    public class ConfigManager
    {
        private readonly Dictionary<string, ConfigCategory> _configCategories =
            new Dictionary<string, ConfigCategory>();

        internal ConfigManager()
        {
            SetDefaults();
        }

        public ConfigCategory this[string key]
        {
            get
            {
                if (_configCategories.ContainsKey(key))
                    return _configCategories[key];

                var category = new ConfigCategory();
                _configCategories[key] = category;
                return category;
            }
        }

        private void SetDefaults()
        {
            this["window"].Set("width", 800);
            this["window"].Set("height", 600);
        }
    }
}